<template>
	<li>
		<label>
			<input type="checkbox" :checked="todo.done" @change="handleCheck(todo.id)"
			>
			<span>
				{{ todo.title }}
			</span>
		</label>
		<button @click="handleDelete(todo.id)"></button>
	</li>
</template>
<script>
	export default {
		name: 'TodoItm',
		props: ['todo', 'checkTodo', 'deleteTodo'],
		methods: {
			handleCheck(id){
				this.checkTodo(id)
			},
			handleDelete(id){
				if (confirm('确定删除吗')){
					this.deleteTodo(id)
				}
			}
		}
	}
</script>